<?php

namespace App\Http\Controllers;

use App\Notifications\RegisNotifacaty;
use App\User;
use Illuminate\Http\Request;

class UserController extends Controller
{

    public function index(){

        return view('zhuce.register');
    }

    public function youjian($token){

//        dd(123);
//        dd($token);
        $user  =  User::where('email_token',$token)->first();
        if ($user){
            $user->status = 1;
            $user->save();
            session()->flash('success','邮件激活成功！！');
            return redirect('/');
        }
    }

    public function zaifa(){
//        dd(123);
        $user = auth()->user();
        \Notification::send($user,new RegisNotifacaty($user));
        session()->flash('success','邮件已经发送至您的邮箱！！');
        return back();
    }
}
